import request from '@/utils/request'

// 获取部门-岗位树
export function getDeptPostTree(searchValue) {
  return request({
    url: '/talent/data/tree',
    method: 'get',
    params: {
      searchValue: searchValue
    }
  })
}

// 根据岗位编码获取人才库字段和数据（支持分页和sheet切换）
export function getTalentData(postCode, pageNum = 1, pageSize = 100, sheetName = null) {
  const params = {
    pageNum,
    pageSize
  }
  if (sheetName) {
    params.sheetName = sheetName
  }
  
  return request({
    url: '/talent/data/' + postCode,
    method: 'get',
    params: params
  })
}

// 保存岗位人才库数据
export function saveTalentData(postCode, data) {
  return request({
    url: '/talent/data/' + postCode,
    method: 'post',
    data: data
  })
}

// 查询招聘状态字典
export function getRecruitmentStatusDict() {
  return request({
    url: '/system/dict/data/type/recruitment_status',
    method: 'get'
  })
}

